package pages

import (
	"net/http"
	"note-go/session"

	"github.com/gin-gonic/gin"
)

func Login(c *gin.Context) {
	sessionID, _ := c.Cookie("session_id")
	_, err := session.GetSession(sessionID)
	if err == nil {
		c.Redirect(http.StatusSeeOther, "/")
		c.Abort()
		return
	}
	c.HTML(http.StatusOK, "login.html", gin.H{
		"title": "登录页面",
	})
}
